#include<iostream>
using namespace std;
int fib[100]={0,1};
int main()
{
	for(int i=2;i<=20;i++)
		fib[i]=fib[i-1]+fib[i-2];
	int n,a,x,m;
	cin>>a>>n>>m>>x;
	int b=(m-fib[n-3]*a-a)/(fib[n-2]-1);
    if(x==1)
    	cout<<a;
    else
    	cout<<(fib[x-2]+1)*a+(fib[x-1]-1)*b;
	return 0;
}
